#include<map>
#include<algorithm>
#include<iostream>
using namespace std;

map<string, int> mp;

bool cmp(pair<string, int> x, pair<string, int> y) {
	return x.second < y.second;
}

int main() {
	string s;
	int n;
	while (cin >> n && n) {
		mp.clear();
		for (int i = 1; i <= n; i++) {
			cin >> s;
			mp[s]++;
		}
		auto mx = max_element(mp.begin(), mp.end(), cmp);
		cout << mx->first << endl;
	}
	return 0;
}
